//
//  BrandSpecilTableVC.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/12.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//
//专区里面的数据都是死得 不用从服务器获取数据

#import "BrandSpecilTableVC.h"
#import "CommonMacro.h"
#import "BrandSpecilCell.h"
#import "SecondBrandCell.h"
#import "MoreBrandCell.h"
@interface BrandSpecilTableVC ()
{
    NSArray *titleArray;
    NSArray *pictureArray;
}

@end

@implementation BrandSpecilTableVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"品牌专区";
    self.tableView.showsVerticalScrollIndicator = NO;
    //设置导航栏颜色
    [self.navigationController.navigationBar setBarTintColor:UIColorWithRGBA(233, 56, 103, 1)];
    //设置文字颜色
    //设置导航栏字体颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil]];
    //左侧返回按钮
    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"返回@2x"] style:UIBarButtonItemStyleDone target:self action:@selector(backClick)];
    self.navigationItem.leftBarButtonItem = leftButton;
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

    
    titleArray = @[@"洗护清洁",@"哺育喂养",@"纸尿裤/拉拉裤",@"婴儿奶粉",@"其他"];
}

#pragma mark 返回上一个界面
- (void)backClick
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - Table view data source


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return titleArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BrandSpecilCell *cell1 = [tableView dequeueReusableCellWithIdentifier:@"Cell1"];
    SecondBrandCell *cell2 = [tableView dequeueReusableCellWithIdentifier:@"Cell2"];
    MoreBrandCell *cell3 = [tableView dequeueReusableCellWithIdentifier:@"Cell3"];
    switch (indexPath.row) {
        case 0:
            if (cell1 == nil) {
                cell1 = [[BrandSpecilCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell1"];
            }
            return cell1;
            break;
        case 1:
            if (cell2 == nil) {
                cell2 = [[SecondBrandCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell2"];
            }
            cell2.titleLabel.text =  @"哺育喂养";
            cell2.brandTitleLabel.text = @"HITO喜多";
            cell2.brandImageView.image = [UIImage imageNamed:@"喜多"];

            return cell2;
            break;

        case 2:
            if (cell1 == nil) {
                cell1 = [[BrandSpecilCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell1"];
            }
            return cell1;
            break;
        case 3:
            if (cell2 == nil) {
                cell2 = [[SecondBrandCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell2"];
            }
            cell2.titleLabel.text =  @"婴儿奶粉";
            cell2.brandImageView.image = [UIImage imageNamed:@"贝因美"];
            cell2.brandTitleLabel.text = @"贝因美";
            return cell2;
        case 4:
            if (cell3 == nil) {
                cell3 = [[MoreBrandCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell3"];
            }
            return cell3;
            
        default:
            break;
    }
    return cell1;
    return cell2;
    return cell3;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0||indexPath.row==2) {
        return 110;
    }
    else if (indexPath.row==1||indexPath.row==3){
        return 110;
    }
    else{
    return 190;
    }
}

@end
